package jdklearning.swing;

import java.awt.*;
import java.lang.management.ManagementFactory;

import javax.swing.*;

/**
 * https://arthas.aliyun.com/doc/quick-start.html
 * https://arthas.aliyun.com/download/3.5.0?mirror=aliyun
 *
 *
 * kubectl --kubeconfig ./config-test get ns
 * kubectl --kubeconfig ./config-test get pod -n platform-document
 * kubectl --kubeconfig ./config-test exec -it pod名称 -n platform-document -- bash
 *
 * 3、拷贝文件到pod
 * kubectl --kubeconfig ./config-test -n platform-document cp ./arthas-packaging-3.5.0-bin.zip document-instance-test-qvdv9-qx6pj:/home/admin
 *
 * 4、登录pod
 *  a.解压文件
 *  c.java -jar arthas-boot.jar
 *
 *  记得 要加权限 chmod –R 777 *
 *
 * @author shenenlu 2021年04月19日 下午18:19:32
 */
public class SwingAndArthas {


    /**
     * java -jar arthas-boot.jar
     * java -jar arthas-boot.jar pid
     * sudo su admin && java -jar arthas-boot.jar 或 sudo -u admin -EH java -jar arthas-boot.jar
     * thread 1 | grep 'main('
     * jad jdklearning.swing.SwingAndArthas
     * watch jdklearning.swing.SwingAndArthas aaa returnObj
     * watch jdklearning.swing.SwingAndArthas aaa params
     * watch jdklearning.swing.SwingAndArthas aaa "{params,returnObj}" -x 2 -b
     * quit
     * stop
     * @param args
     */

    public static void main(String[] args) {
        System.out.println(ManagementFactory.getRuntimeMXBean().getName());
        JFrame jf = new JFrame();
        jf.setTitle("test");
        jf.setSize(500,500);
        jf.setLocation(400,200);//位置
        jf.setSize(350,200);//尺寸
        jf.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        //创建流式布局对象(左对齐,水平间距20,垂直间距40)
        FlowLayout fl=new FlowLayout(FlowLayout.LEFT,20,40);
        jf.setLayout(fl);

        JButton jb = new JButton("test");
        jf.add(jb);

        JTextField jtf = new JTextField("",10);
        jf.add(jtf);
        jf.setVisible(true);
        jb.addActionListener(e -> jtf.setText(aaa(jtf.getText())));
    }


    public static String aaa(){
        return "aaa";
    }

    public static String aaa(String param){
        return param;
    }
}
